<%--
  Created by IntelliJ IDEA.
  User: c
  Date: 2017-11-17
  Time: 21:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <%@include file="/WEB-INF/jsp/header.jsp"%>
</head>
<script src="${ctx}/statics/js/jquery-1.12.4.js"></script>
<style>
    table td{
        font: 14px 'microsoft yahei', 微软雅黑, Helvetica, Arial, Tahoma, 黑体, 宋体, sans-serif;
    }
</style>
<body>
    <div class="container-fluid" style="width: 80%;">
        <div style="text-align: center">
            <span class="h3">药品采购明细信息</span>
        </div>
        <div>
            <p><label>NO&nbsp;&nbsp;：</label>&nbsp;${pur.planNum}</p>
            <p><label >日期：</label>
                <fmt:formatDate value="${pur.planDate}" var="date" pattern="yyyy年MM月dd日"/>
                ${date}
            </p>

        </div>

        <table class="table table-bordered" style="margin-top: 16px;">
            <tr>
                <td colspan="2" class="text-center h4">采购基本信息</td>
            </tr>
            <tr>
                <td><label >供应商：</label><span>${pur.provider.proName}</span></td>
                <td><label >采购员：</label><span>${pur.worker.woName}</span></td>
            </tr>
            <tr>
                <td><label >联系人：</label><span>${pur.provider.proPerson}</span></td>
                <td><label >电&nbsp;&nbsp;&nbsp;话：</label><span>${pur.worker.woPhone}</span></td>
            </tr>
            <tr>
                <td><label >地&nbsp;&nbsp;&nbsp;址：</label><span>${pur.provider.proReaddress}</span></td>
                <td rowspan="3">
                    <label class=" pull-right" style="margin-top: 80px;">审&nbsp;&nbsp;&nbsp;核：
                        <span>${pur.planChstate==0?'待审核':pur.planChstate==1?'已通过':'未通过'}</span>
                    </label>

                </td>
            </tr>
            <tr>
                <td><label >电&nbsp;&nbsp;&nbsp;话：</label><span>${pur.provider.proPhone}</span></td>

            </tr>
            <tr>
                <td><label >传&nbsp;&nbsp;&nbsp;真：</label><span>${pur.provider.proFax}</span></td>
            </tr>
        </table>

        <table id="delTable" class="table table-bordered ">
                <tr class="back">
                    <th rowspan="2" class="text-center">
                        <span style="line-height: 73px;">序号</span>
                    </th>
                    <th colspan="4" class="text-center">
                        药品信息
                    </th>
                    <th colspan="2" class="text-center">
                        价格(人民币:元)
                    </th>
                </tr>
                <tr class="back">
                    <th >药品名称</th>
                    <th >规格</th>
                    <th >购进数量</th>
                    <th >单位</th>
                    <th >单价(元)</th>
                    <th >小计</th>
                </tr>
                <c:forEach items="${list}" var="p">
                    <tr>
                        <td>${p.delId}</td>
                        <td>${p.druginfo.drugName}</td>
                        <td>${p.druginfo.drugStandard}</td>
                        <td class="delBuynum">${p.delBuynum}</td>
                        <td>${p.druginfo.drugUnit}</td>
                        <td>${p.delOneprice}</td>
                        <td class="money" style="color: red;">
                            ￥<span><fmt:formatNumber type="number" value="${p.delBuynum*p.delOneprice}" pattern="0.00" maxFractionDigits="2"/></span>
                        </td>
                    </tr>
                </c:forEach>
                <tr>
                    <th colspan="3" style="text-align: right;">合计数量及金额：</th>
                    <th>
                        <span id="num"></span>
                        <script>
                            var totalNum=0;
                            $("table#delTable td.delBuynum").each(function(){
                                totalNum+=parseInt( $(this).html());
                            });
                            $("span#num").html(totalNum)
                        </script>
                    </th>
                    <th></th>
                    <th></th>
                    <th>
                        <span id="totalMo"></span>
                        <script>
                            var totalMoney=0.00;
                            $("table#delTable td.money").each(function(){
                                totalMoney+=parseFloat( $(this).find("span").html());
                            });
                            $("span#totalMo").html("￥"+totalMoney)
                        </script>
                    </th>
                </tr>
        </table>
    </div>
<%@include file="/WEB-INF/jsp/footer.jsp"%>
    <script src="${ctx}/res/js/Purplan.js"></script>
</body>
</html>
